import 'package:dio/dio.dart';
import 'package:lib_core/net/interceptors/dio_log_interceptor.dart';
import 'package:lib_core/net/interceptors/error_interceptor.dart';
import 'package:lib_core/net/interceptors/option_interceptor.dart';

class DioClient {
  static late final Dio dio;
  static final DioClient _instance = DioClient._internal();
  factory DioClient() => _instance;

  DioClient._internal() {
    var option = BaseOptions(
      connectTimeout: Duration(seconds: 10 * 1000),
      receiveTimeout: Duration(seconds: 10 * 1000),
    );
    dio = Dio(option);
    dio.interceptors.addAll([
      OptionInterceptor(),
      DioLogInterceptor(),
      ErrorInterceptor(),
    ]);
  }

  void init() {}
}